package com.sofwin.service.impl;

import com.fasterxml.jackson.databind.exc.InvalidNullException;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sofwin.dto.CinformationDto;
import com.sofwin.mapper.CCompanyMapper;
import com.sofwin.mapper.CInformationMapper;
import com.sofwin.pojo.CCompany;
import com.sofwin.pojo.CCompanyExample;
import com.sofwin.pojo.CInformationExample;
import com.sofwin.pojo.CInformationWithBLOBs;
import com.sofwin.service.CinformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @program: ssm-parent
 * @description: TODO
 * @author: Mr.Gao
 * @create: 2021-04-23 15:57
 **/
@Service
public class CinformationServiceImpl implements CinformationService {

    @Autowired
    private CInformationMapper cInformationMapper;

    /**
    * @Description: 查询企业数据管理
    * @param cInformation: Dto扩展类
    * @param pageNumber: 当前页码
    * @param pageSize: 每页显示的条数
    * @return: PageInfo<CinformationDto>
    * @Author: Mr.Gao
    * @Date: 2021/4/24
    */
    @Override
    public PageInfo<CinformationDto> selectCinformationByPage(CinformationDto cInformation, Integer pageNumber, Integer pageSize) {
        String companyName = cInformation.getCompanyName();
        if (companyName!=null  && companyName!="") {
            companyName = "%" + companyName + "%";
        }
        String industry = cInformation.getIndustry();
        if (industry!=null && industry!=""){
            industry = "%"+industry+"%";
        }
        PageHelper.startPage(pageNumber,pageSize);
        List<CinformationDto> cinformationDtos = cInformationMapper.selectAll(companyName,industry);
        return new PageInfo<CinformationDto>(cinformationDtos);
    }
}
